package cn.edu.ecut.se2024.dao;

import cn.edu.ecut.se2024.model.PaymentMethod;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PaymentMethodDao {

    @Select("select * from payment_method where user_id = #{userId}")
    List<PaymentMethod> getPaymentMethodsByUserId(int userId);
    
    @Select("select * from payment_method where user_id = #{userId} and type = #{type}")
    PaymentMethod getPaymentMethodByType(@Param("userId") int userId, @Param("type") String type);
    
    @Select("select sum(order_amount) from orders where user_id = #{userId}")
    double getOrderAmountByUserId(int userId);
    

}

